<template>
	<view class="content">
		<view class="doc-list" v-for="(item,index) in dataList" :key="index">
			<view class="list-title">{{item.department}}</view>
			<view class="doc-item">
				<view class="list-item" v-for="(itema,indexa) in item.doctors" :key="itema.id" @click="goDetail(itema)">
					{{itema.doctorName}}
				</view>

			</view>
		</view>
	</view>
</template>

<script>
	import {
		doctorsdepartApi
	} from "@/api/user"
	export default {
		data() {
			return {
				dataList: [],
			}
		},
		onLoad() {
			this.getList()
		},
		methods: {
			async getList() {
				uni.showLoading({
					title: '加载中...',
					mask: true
				})
				try {
					const res = await doctorsdepartApi()
					console.log(res);
					this.dataList = res.data
					uni.hideLoading()
				} catch (e) {
					uni.hideLoading()
				}
			},
			goDetail(item) {
				uni.navigateTo({
					url: `/pages/hospitaldoctordesc/hospitaldoctordesc?id=${item.id}`
				})
			},
		}
	}
</script>

<style scoped>
	.content {
		width: 100vw;
		min-height: 100%;
		box-sizing: border-box;
		background: #F8F8F8;
		color: #000000;
		font-size: 23rpx;
		padding-top: 31rpx;
		box-sizing: border-box;
		padding-bottom: calc(31rpx + env(safe-area-inset-bottom));
	}

	.doc-list {
		margin-left: 31rpx;
		margin-bottom: 31rpx;
	}

	.list-title {
		font-weight: 500;
		font-size: 31rpx;
	}

	.doc-item {
		display: flex;
		flex-wrap: wrap;
	}

	.list-item {
		width: 215rpx;
		height: 63rpx;
		background: #FFFFFF;
		border-radius: 10rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		margin-top: 23rpx;
		margin-right: 21rpx;
	}
</style>